home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / extra_2 / flmgmtcl.zip / DIRLIST.H < prev    next >
C/C++ Source or Header  |  1995-11-02  |  4KB  |  135 lines

  1. // ==========================================================================
  2. //                             Class Specification : CDirList
  3. // ==========================================================================
  4.  
  5. // Header file : dirlist.h
  6.  
  7. // Source : Periphere NV (R.Mortelmans)
  8. // Creation Date :        2nd November 1995
  9. // Last Modification : 2nd November 1995
  10.                           
  11. // //////////////////////////////////////////////////////////////////////////
  12.  
  13. // Properties:
  14. //    NO    Abstract class (does not have any objects)
  15. //    YES    Derived from CObject
  16.  
  17. //    NO    Is a Cwnd.                     
  18. //    NO    Two stage creation (constructor & Create())
  19. //    NO    Has a message map
  20. //    NO  Needs a resource (template)
  21.  
  22. //    NO    Persistent objects (saveable on disk)      
  23. //    NO    Uses exceptions
  24.  
  25. // //////////////////////////////////////////////////////////////////////////
  26.  
  27. // Desciption :         
  28. //        This class is used to get a list of all the directories in a
  29. //        certain path.
  30. //        You first set the path, by specifying it    (SetPath())
  31. //        Then you start the search                    (Search())
  32. //        And then you examine the result                (GetList())
  33.  
  34. // Remark:
  35. //        ***
  36.  
  37. // Prerequisites (necessary conditions):
  38. //        ***
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. #ifndef __DIRLIST_H__
  42. #define __DIRLIST_H__
  43.  
  44. #include "path.h"
  45.  
  46. class CDirList : public CObject
  47. {
  48. DECLARE_DYNAMIC(CDirList)
  49.  
  50. // Data members -------------------------------------------------------------
  51. public:
  52.     
  53. protected:
  54.     CPathSpec    m_path;
  55.     CObArray    m_dirArray;    
  56.  
  57. private:
  58.     
  59. // Member functions ---------------------------------------------------------
  60. public:
  61.     CDirList();
  62.     // --- In  :
  63.     // --- Out : 
  64.     // --- Returns :
  65.     // --- Effect : Contructor of object
  66.     //                It will initialize the internal state
  67.  
  68.     CPathSpec GetPath() const;
  69.     // --- In  :
  70.     // --- Out : 
  71.     // --- Returns : The path of dirlist
  72.     // --- Effect : 
  73.     BOOL SetPath(CPathSpec path);
  74.     // --- In  : path : The new path specification of the dirlist
  75.     // --- Out : 
  76.     // --- Returns : Whether the setting succeeded or not
  77.     // --- Effect : The specified path is converted to an absolute path
  78.     //                if it is relative
  79.     //                When no file specification is supplied *.* is assumed
  80.                     
  81.     BOOL Search();                    
  82.     // --- In  : 
  83.     // --- Out : 
  84.     // --- Returns : Whether the search succeeded or not
  85.     // --- Effect : This function will search the directory specified
  86.     //                by SetPath and build a list of dir specifications
  87.     //                All the found dirs are appended to the list
  88.     //                These can be accessed by GetList
  89.  
  90.     const CObArray* GetList() const;                    
  91.     // --- In  : 
  92.     // --- Out : 
  93.     // --- Returns : A const pointer to the list of const dir specifications
  94.     // --- Effect : The list may be empty, when search did not find any dirs
  95.     
  96.     const CDirSpec* GetAt(int nIndex) const;
  97.     // --- In  :
  98.     // --- Out :
  99.     // --- Returns :
  100.     // --- Effect :    
  101.  
  102.     void Sort();
  103.     // --- In  : 
  104.     // --- Out : 
  105.     // --- Returns : 
  106.     // --- Effect : Sorts the Dir list
  107.     
  108.     void ClearList();
  109.     // --- In  : 
  110.     // --- Out : 
  111.     // --- Returns : 
  112.     // --- Effect : Clears the dir list
  113.     
  114. #ifdef _DEBUG
  115.     virtual void Dump(CDumpContext&) const;
  116.     virtual void AssertValid() const;
  117. #endif //_DEBUG
  118.  
  119.     virtual ~CDirList();
  120.     // --- In  :
  121.     // --- Out : 
  122.     // --- Returns :
  123.     // --- Effect : Destructor of object
  124.  
  125. protected:      
  126.  
  127. private:
  128.                    
  129. // Message handlers ---------------------------------------------------------
  130.  
  131. };
  132.  
  133. #endif              
  134. // ==========================================================================
  135.